package com.baidu._04_TreeSet;

import java.util.Comparator;
import java.util.TreeSet;

public class Test04 {
    public static void main(String[] args) {
        TreeSet<String> set = new TreeSet<>(new Comparator<String>(){
            public int compare(String s1, String s2){

                return s2.length() - s1.length() != 0 ? s2.length() - s1.length() : s2.compareTo(s1);
            }
        });


//        TreeSet<String> set = new TreeSet<>((s1, s2) -> {
//            int res = s2.length() - s1.length();
////            if(res == 0) {
////                return s2.compareTo(s1);
////            }
//            return res != 0 ? res : s2.compareTo(s1);
//        });

        set.add("abddd");
        set.add("deeeewew");
        set.add("4332kddfddfdassdds");
        set.add("4332zddfddfdassdds");
        set.add("ddk");
        set.add("a");
        System.out.println(set);
    }
}
